package com.ovhoo.vdm.vdm;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

/**
 * Implementation of quote from the website viedemerde.com(VDM)
 * This code is based on http://code.google.com/p/fmlwidget who implements the equivalent for the english version FML
 * must agree with the original licence http://www.apache.org/licenses/LICENSE-2.0
 * 
 * @author azalsup
 *
 */
public class Quote {
	private int id;
    private String author;
    private String category;
    private int agree;
    private int deserved;
    private int nbComments;
    private int commentsFlag;
    private String message;
    private Date date;

    private ArrayList<Comment> comments = new ArrayList<Comment>();

    public void addComment(Comment comment) {
        comments.add(comment);
    }

    public String getAuthor() {
        return this.author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getCategory() {
        return this.category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public int getAgree() {
        return this.agree;
    }

    public void setAgree(int agree) {
        this.agree = agree;
    }
    
    public void setAgree(String agree) {
        this.agree = Integer.parseInt(agree);
    }

    public int getDeserved() {
        return this.deserved;
    }

    public void setDeserved(int deserved) {
        this.deserved = deserved;
    }
    
    public void setDeserved(String agree) {
        this.deserved = Integer.parseInt(agree);
    }

    public int getNbComments() {
        return this.nbComments;
    }

    public void setNbComments(int nbr) {
        this.nbComments = nbr;
    }
    
    public void setNbComments(String str) {
        this.nbComments = Integer.parseInt(str);
    }


    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public ArrayList<Comment> getComments() {
        return this.comments;
    }

    public void setComments(ArrayList<Comment> comments) {
        this.comments = comments;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Date getDate() {
        return this.date;
    }

    public void setCommentsFlag(int commentsFlag) {
        this.commentsFlag = commentsFlag;
    }

    public int getCommentsFlag() {
        return this.commentsFlag;
    }

    public void setId(int id) {
        this.id = id;
    }
    
    public void setId(String id) {
    	try {
    		this.id = Integer.parseInt( id );
    	} catch (Exception e) {
            this.setId(0);
        }
    }

    public int getId() {
        return this.id;
    }

    class Comment implements Serializable {
        /**
		 * 
		 */
		private static final long serialVersionUID = 2334864723450682784L;
		
		
		private String author;
        private String text;

        public String getAuthor() {
            return this.author;
        }

        public void setAuthor(String author) {
            this.author = author;
        }

        public String getText() {
            return this.text;
        }

        public void setText(String text) {
            this.text = text;
        }

    }

   
    
}



